#!/bin/bash
read injson
echo ${injson}|sed -e 's/"//g;s/,/\n/g;s/{/{\n/g;s/}/\n}/g'|awk -F ":" 'BEGIN{topic=""};/:{/{length(topic)>0 ? topic=topic$1"/" : topic=$1"/"};!/{/&&!/}/{print "\""topic$1"\":\""$2"\""};/}/{l=split(topic,t,"/");topic="";for(i=1;i<(l-1);i++)topic=topic""t[i]"/"}'
